class Solution {
public:
    int findMaxConsecutiveOnes(vector<int>& nums) {
          int length=0;
          int result=0;
          int i;
          for(i=0;i<nums.size();i++)
          {
              if (nums[i]==1){
                  length++;
              }
              else{
                  result=result<length ? length :result;
                  length=0;
              }
          }
          return result=result<length ? length :result;
    }
};
